home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.19971216-19980424
/
000134_news@newsmaster….columbia.edu _Wed Jan 28 21:01:50 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
4KB
Return-Path: <news@newsmaster.cc.columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id VAA09331
for <kermit.misc@watsun.cc.columbia.edu>; Wed, 28 Jan 1998 21:01:50 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id VAA00199
for kermit.misc@watsun; Wed, 28 Jan 1998 21:01:49 -0500 (EST)
Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Expect and Kermit (was: Re: frequent timeouts!)
Date: 29 Jan 1998 02:01:49 GMT
Organization: Columbia University
Lines: 65
Message-ID: <6aonud$42r$1@apakabar.cc.columbia.edu>
References: <6ao7uh$9qf$1@cronkite.ocis.temple.edu> <6ao98e$p4h$1@apakabar.cc.columbia.edu> <gerlachEnIuIF.K4L@netcom.com>
NNTP-Posting-Host: watsun.cc.columbia.edu
Xref: news.columbia.edu comp.protocols.kermit.misc:8316
In article <gerlachEnIuIF.K4L@netcom.com>,
Matthew H. Gerlach <gerlach@netcom.com> wrote:
: The kermit scripting language is a greate thing, most notably the fact
: that kermit scripts will run on many platforms. That being said I find
: it very beneficial to control C-Kermit from Expect, and I work for a company
: that does a lot of it. The main benefit is that one might need to write
: a script that controls many serial connections in conjuction with
: many connections to regular UNIX programs. This appears to be easier with
: Expect.
:
Some concrete examples might be instructive.
: Furthermore, Tk/Expect allows one to easily put a "pretty face"
: gui on said script.
:
One ought to be able to do that anyway. Code the user interface in Tk/Expect
or whatever, and the real stuff in the Kermit script. Keeps the bosses happy
by looking pretty, and keeps the rest of us happy by working well :-)
: In conclusion there are problems best solved by kermit scripts and problems
: best solved using Expect and there are even more problems best suited to
: Perl, which I prefer. Use the best tool to solve the problem.
:
Agreed, provided it works. If Kermit doesn't work with expect (I'm not
saying it doesn't), then the best tool is Kermit without expect. Given the
amount of resources we have, there is a limit to the number of combinations
we can support. But of course, that's where this newsgroup comes in handy.
Meanwhile, I think this is a useful dialog. If my understanding of the
Expect approach is correct, it is basically a screen-scraper, looking for
the Kermit prompt, feeding commands to it, parsing the results, and so on
in a loop of some kind until the desired result is achieved. But Kermit's
language includes a lot of features that don't fit this model, such as
FOR and WHILE loops, SWITCH statements, IF-ELSE constructions, even GOTOs.
I suppose these might be simulated at a "higher level", but isn't that
pushing the model a bit? Also, note that every Kermit command returns a
status that can be tested by IF SUCCESS (or IF FAILURE); how do you do that
with Expect?
For actual communications, Kermit's INPUT and OUTPUT (and IF, etc) commands
perform selected actions based on what the other computer sends. The MINPUT
command is especially handy, allowing us to scan for several strings at
once, for example:
set carrier-watch off
while 1 {
output ATDT7654321\13
minput 60 CONNECT {NO ANSWER} {NO DIALTONE} {NO CARRIER} BUSY
switch \v(minput) {
:0, end 1 Timed out
:1, echo Call complete, break
:2, end 1 No answer - try again later.
:3, end 1 No dialtone - check the phone.
:4, end 1 Connection failed.
:5, echo Redialing..., continue
:default, stop 1 impossible error
}
}
(This does approximately what the built-in DIAL command does.) You can put
this loop in another loop that calls a list of numbers in succession, in a
table-driven way, and so on. How would one do this by having Expect feed
commands to the C-Kermit prompt?
- Frank